package com.expense.util;

public class ConfigUtil {
	private static PropertiesReader prop = PropertiesReader.getIntance("/conf.properties");
	 
	/**配置要备份的表***/
	public static String webServiceAddr=prop.getProperty("webServiceAddr");
	
	
	/**分页默认pageSize**/
	public static int pageSize=convetInt(prop.getProperty("pageSize"));
	
	
	/**是否一次发送备份邮件**/
	public static boolean dbbackup_onceSend=convetBoolean(prop.getProperty("dbbackup_onceSend"));
	
	/**配置要备份的表***/
	public static String dbbackup_dbNames=prop.getProperty("dbbackup_dbNames");
	
	/**备份时是否读配置文件的表**/
	public static boolean readConfigDbNames=convetBoolean(prop.getProperty("readConfigDbNames"));
	
	/**备份数据库的时间点**/
	public static int C_SCHEDULE_HOUR=convetInt(prop.getProperty("C_SCHEDULE_HOUR"));
	
	/**备份数据库  的 间隔周期  小时数**/
	public static int cycle_SCHEDULE_HOUR=convetInt(prop.getProperty("cycle_SCHEDULE_HOUR"));
	
	/**备份数据库 发送到哪些Email***/
	public static String dbBackUpToEmail=prop.getProperty("dbBackUpToEmail");
	
	/**系统邮箱设置***/
	public static String sysEmilHost=prop.getProperty("sysEmilHost");
	public static String sysEmailUserName=prop.getProperty("sysEmailUserName");
	public static String sysEmailPassword=prop.getProperty("sysEmailPassword");
	
	
	
	public static boolean convetBoolean(String string){
		boolean ifalg=false;
		if(string!=null&&string.equals("true")){
			ifalg=true;
		}
		return ifalg; 
	}
	
	public static int convetInt(String string){
		int value=0;
		if(string!=null&&!string.equals("")){
			try {
				value=new Integer(string);
			} catch (Exception e) {
				// TODO: handle exception
			}
			
		}
		return value;
		
	}
	
}
